package com.bankcomm.ui.specialwidget;

import com.bankcomm.common.LPMid;
import com.rytong.tools.ui.Component;
import com.rytong.tools.utils.Utils;

import android.app.Activity;
import android.content.Context;
import android.view.View;

/**
 * hidden控件只是作为后台信息的一个载体,不占空间,不显示
 * 
 * @author Jade
 * 
 */
public class LPHidden extends Component {
    public class MyLPHidden extends View implements CompositedComponent {

        public MyLPHidden(Context context) {
            super(context);
            // TODO Auto-generated constructor stub
            setVisibility(View.GONE);
        }

        @Override
        public Component composited() {
            // TODO Auto-generated method stub
            return LPHidden.this;
        }

    }

    @Override
    public void initRealView(Activity activity, String nodeValue) {
        // TODO Auto-generated method stub
        super.initRealView(activity, nodeValue);
        realView_ = new MyLPHidden(activity);
    }

	@Override
	public void mouldH() throws Exception {
		// TODO Auto-generated method stub
        /**
         * 登陆后移之后，登陆成功后，将登陆信息放在hidden中，在这里做解析
         */
        String name = getPropertyByName("name");
        if(null != name && name.equalsIgnoreCase("login")){
        	String value = getPropertyByName("value");
        	if(null != value && !"".equalsIgnoreCase(value) && !LPMid.getInstance().um_.data.isLogin){
        		try {
					LPMid.getInstance().um_.data.parseLoginMessage(value);
					//由于框架中是先解析后压栈，所以解析到登陆成功后直接清楚栈顶的页面，之后不考虑
					if(LPMid.getInstance().um_.data.isLogin && null != Component.ACTIONV){
						int size = Component.ACTIONV.size();
						Component.ACTIONV.remove(size-1);							
					}
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
        	}
        }
	}
}
